<template>
  <a-config-provider :locale="locale">
    <div id="app">
      <router-view/>
    </div>
  </a-config-provider>
</template>
<script>
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
import enquireScreen from '@/utils/device'
import Vue from 'vue'
import { mapGetters } from 'vuex'
import { SPECIAL_EFFECTS } from '@/store/mutation-types'
  export default {
    data () {
      return {
        locale: zhCN,
        propData: {
          userType: ''
        }
      }
    },
    created () {
      let that = this
      this.$store.dispatch('setSpecialEffects', Vue.ls.get(SPECIAL_EFFECTS) === 'true');
      enquireScreen(deviceType => {
        // tablet
        if (deviceType === 0) {
          that.$store.commit('TOGGLE_DEVICE', 'mobile')
          that.$store.dispatch('setSidebar', false)
        }
        // mobile
        else if (deviceType === 1) {
          that.$store.commit('TOGGLE_DEVICE', 'mobile')
          that.$store.dispatch('setSidebar', false)
        } else {
          that.$store.commit('TOGGLE_DEVICE', 'desktop')
          that.$store.dispatch('setSidebar', true)
        }
      })
    },
    mounted() {
      // 判断补填上周工时
      this.$store.dispatch('checkMustFillHours').then(res => {
        if (res) {
          if (res.lastWeek === 'no'){
            // 直接跳转到工时填报页面
            this.$router.push({ path: '/taskTimeInputList/index' })
          }
        }
      })
    },
    methods: {
      ...mapGetters(['userInfo']),
    }
  }
</script>
<style>
  #app {
    height: 100%;
    -webkit-user-select: auto !important;

    -moz-user-select: auto !important;

    -ms-user-select: auto !important;

    user-select: auto !important;
  }
  .ant-select-disabled .ant-select-selection {
    -webkit-user-select: auto !important;

    -moz-user-select: auto !important;

    -ms-user-select: auto !important;

    user-select: auto !important;
  }
  .ant-table-placeholder{
    z-index: 0 !important;
  }
  .ant-message {
    z-index: 100000 !important;
  }
</style>
